package com.lanou3g.code0427.study;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * Created by dllo on 18/4/27.
 */
public class Main {
    public static void main(String[] args) {
        Properties properties = new Properties(); // 读取配置文件的 Resource Bundel建文件test
        FileInputStream fis = null;
        try {
            fis = new FileInputStream("test.properties");// 读取test文件
            properties.load(fis); // 建立起了 配置对象和配置文件的联系

            // 通过 配置文件的KEY 来 拿到VALUE
            String username= properties.getProperty("username");
            String password= properties.getProperty("password");
            System.out.println(username+"-"+password);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
